/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 *
 */

import { FileSet } from '@ohos/hvigor';
import { ProjectConfig } from '@ohos/hvigor-arkts-compose';
import path from 'path';

import { OhosLogger } from '../../../utils/log/ohos-logger.js';
import { LegacyArkCompile } from '../legacy-ark-compile.js';

import { BuildUnitTestHook } from '../../unitTest/build-unit-test-hook.js';

/**
 * 单元测试ArkTS编译 fa模型
 *
 * @since 2023/4/23
 */
export class LegacyUnitTestArkCompile extends LegacyArkCompile {
  logger: OhosLogger = OhosLogger.getLogger(LegacyUnitTestArkCompile.name);

  declareInputFiles(): FileSet {
    return super.declareInputFiles();
  }

  protected async initDefaultArkCompileConfig(): Promise<ProjectConfig> {
    return {
      ...(await super.initDefaultArkCompileConfig()),
      aceModuleJsonPath: undefined,
      aceModuleBuild: path.resolve(this.pathInfo.getInterMediatesAssetsPath(), this.codeType),
    };
  }

  public initTaskDepends(): void {
    this.declareDepends(BuildUnitTestHook.name);
  }

  protected async doTaskAction(): Promise<void> {
    await super.doTaskAction();
  }
}
